package com.cssw.fyzb.web.service;

import com.cssw.fyzb.base.web.domain.AjaxData;
import com.cssw.fyzb.base.web.domain.AjaxPage;
import com.cssw.fyzb.core.dao.acct.UserCashOutDao;
import com.cssw.fyzb.core.model.dodb.User;
import com.cssw.fyzb.web.vo.UserCashOutVo;
import com.ydn.dbframe.plugin.activerecord.Db;
import com.ydn.dbframe.plugin.activerecord.Page;
import com.ydn.dbframe.plugin.activerecord.Record;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Auther: zzf
 * @Date: 2020/12/2 15:22
 * @Description:AddAppealVo
 */
@Service
public class UserCashOutService {

    @Autowired
    private UserCashOutDao userCashOutDao;

    public AjaxPage list(int page, int limit, Map param) {
        Page<Record> list = userCashOutDao.list(page, limit, param);
        List<UserCashOutVo> funcVos = new ArrayList<>();
        if (null != list.getList() && list.getList().size() != 0) {
            UserCashOutVo userCashOutVo = null;
            for (Record res : list.getList()) {
                userCashOutVo = new UserCashOutVo();
                userCashOutVo.setNickName(res.getStr("nick_name"));
                userCashOutVo.setMobile(res.getStr("mobile"));
                userCashOutVo.setCashId(res.getLong("cash_id"));
                userCashOutVo.setAcctId(res.getLong("acct_id"));
                userCashOutVo.setUserId(res.getLong("user_id"));
                userCashOutVo.setAcctType(res.getStr("acct_type"));
                userCashOutVo.setCashOutRatio(res.getStr("cash_out_ratio"));
                userCashOutVo.setCashOutFee(res.getBigDecimal("cash_out_fee"));
                userCashOutVo.setHandlingFee(res.getBigDecimal("handling_fee"));
                userCashOutVo.setBananceFee(res.getStr("banance_fee"));
                userCashOutVo.setCashAmount(res.getBigDecimal("cash_amount"));
                userCashOutVo.setStatus(res.getStr("status"));
                userCashOutVo.setRemark(res.getStr("remark"));
                userCashOutVo.setCashAcctType(res.getStr("cash_acct_type"));
                userCashOutVo.setCreateTime(res.getStr("create_time"));
                userCashOutVo.setFinishTime(res.getStr("finish_time"));
                userCashOutVo.setDayTime(res.getLong("day_time"));
                funcVos.add(userCashOutVo);
            }
        }

        return AjaxPage.success(funcVos, list.getTotalRow(), list.getTotalPage());
    }
}
